All Questions
491 questions
-1votes
0answers
27views
Why the loss values of class type and function type of tensorflow models are different?
I made two different type models with tensorflow, one is Class type, the other is function type for learning Fashion MNIST. I think the structure of two models is exactly same, but the results are not....
0votes
0answers
90views
My testing loss isn't improving while I'm using same train and test data
I'm trying to fine tune a model for a segmentation task. To see if everything is working properly I'm trying to make my model overfit on a single image split in 16 different patches. So in my code, I ...
-1votes
1answer
46views
implement a differentiable L0 regularizer to keras layer
What is the appropriate way to implement a differentiable variant of L0 regularizer (count the non-zero values in a Conv layer / matrix) to keras layer? I was thinking of using r(x) = tanh(abs(f*x)) ...
2votes
0answers
67views
Can't replicate the behaviour of loss calculation in keras
I am working on a semantic segmentation problem where I have an input x ( CT image) to a deep learning model of shape (batch_size,1,256,256) and an output of shape (batch_size,2,256,256) where the ...
0votes
0answers
36views
How to make a customloss function with more variable inputs work
I am making or trying to make a model that can estimate intrinsic camera parameters. For this, I want to use a custom loss function that uses the estimated intrinsic camera parameters, and then ...
0votes
1answer
42views
TensorFlow: Calculating gradients of regularization loss terms dependent on model input and output
Overview My model is an encoder that has input Z and output x. I'm trying to use a total_loss that has both traditional supervised learning and regularization term(s). I have additional functions (...
0votes
0answers
37views
ValueError: Cannot Reshape Tensor When Training ENet Model with Discriminative Loss Function
I’m currently working on a lane detection project using instance segmentation and following this tutorial. I’m attempting to train an ENet model with a discriminative loss function, but I'm ...
0votes
0answers
43views
keras.models.load_model() reinitalized custom lossfunction to default arguments
I am tring to make and then save a model in python file, and then train the model in another file. This model uses a custom loss function that is in a seperate python file, so it can be imported into ...
1vote
1answer
98views
In Keras, how can I save and load a neural network model that includes a custom loss function?
I am having difficulty saving and reloading a neural network model when I use a custom loss function. For example, in the code below (which integrates the suggestions of the related questions here ...
0votes
0answers
68views
Custom Loss function Cannot squeeze axis=-1
I'm working on implementing a custom loss function in TensorFlow/Keras that incorporates both categorical cross-entropy loss and a penalty based on custom rules. These rules are designed to penalize ...
1vote
0answers
35views
How to use Encoder predictions for additional loss and gradient calculations (Tensorflow)
Problem I'm having troubles correctly adding physics-informed losses to my training code for my neural network. Background I have an encoder that takes an input curve, X(w), where w is an independent ...
0votes
0answers
46views
Issues with Custom Smoothed Hamming Loss
I am trying to train an autoencoder using a custom hamming loss function. The code is as follows, import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.keras.layers import Input, ...
-1votes
1answer
212views
How to interpret training and validation loss graph in Keras, is it a good fit? [closed]
I've trained a Keras model and obtained a graph with training and validation loss curves. The graph shows the following pattern: enter image description here Can someone help me interpret this graph? ...
0votes
0answers
119views
Defining a loss function with partial output of a neural network using Tensorflow
I have the following problem: Given an image my model outputs a 3-dimensional binary vector that consists of three features that need to infer from the image. Since, I don't care about the first ...
0votes
2answers
72views
Why generator loss using BinaryCrossEntropy with from_logits enabled?
From a simple vanilla GAN code I look from GitHub I saw this generator model with activation sigmoid: # Generator G = tf.keras.models.Sequential([ tf.keras.layers.Dense(28*28 // 2, input_shape = (...